<template>
  <div class="abstract">

    <div class="card_profile">

      <img
          :src="card.user.faceUrl"
          alt=""
          class="abstract_face"
      />
      <p class="push_text">
        <span class="name">{{ card.user.name }}</span>
        <span class="push_date">{{ card.pushDate }}</span>
      </p>
    </div>

    <div class="abstract_menu">
      <i :class="!(isFollow||isFollow2)?'iconfont icon-Heart o':'iconfont icon-kaixin oo'" @click="saylove"></i>
    </div>
  </div>
</template>

<script>
import {Toast} from "vant";
import { mapMutations } from 'vuex'
export default {
  props: {
    isFollow: {
      type: Boolean
      // default: false
    },
    card:{
      type: Object
    }
  },
  data() {
    return {
      isFollow2: false
    }
  },
  methods: {
    ...mapMutations(['toFollow']),
    saylove() {
      if (!(this.isFollow || this.isFollow2)) {
        this.isFollow2 = true
        this.toFollow(this.card.user.uid);
        Toast({
          message: '关注成功❤️',
          duration: 200
        });
      } else {
        Toast({
          message: '关注了🥺',
          duration: 500
        });
      }
    }
  }
}
</script>

<style lang="less">
.abstract {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 16px 6px;
}

.abstract_face {
  float: left;
  width: 40px;
  height: 40px;
  border-radius: 100%;
  //padding: 0 16px;
  margin-right: 10px;
  opacity: 1;
  transition: all 0.6s ease;

  .push-image {
    display: inline-block;
    width: 50px;
    height: 50px;
    border-radius: 100%;
    background-size: cover;
    background-position: 0 2px;
    margin-left: -16px;
    vertical-align: top;
  }
}

.abstract_menu {
  color: #ddd;
}

.o {
  font-size: 24px;
  transition: all 1s;
}

.oo {
  font-size: 16px;
  transition: all 1s;
}

.push_text {
  display: flex;
  flex: 1;
  flex-direction: column;
  margin-left: 20px;
  line-height: 20px;

  .name {
    font-weight: 600;
    font-size: 14px;
    text-align: left;
    color: #222;
  }

  .push_date {
    font-style: italic;
    font-size: 12px;
    color: #999;
  }
}
</style>
